package MyApp.Controller
{
	import MyApp.Model.proxy.ReportProxy;
	
	import components.report.ReportWindow;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class ReportCommand extends SimpleCommand
	{
		public function ReportCommand()
		{
			super();
		}
		private function get proxy():ReportProxy{
			if(!facade.hasProxy(ReportProxy.NAME)){
				facade.registerProxy(new ReportProxy(ReportProxy.NAME));
			}
			return facade.retrieveProxy(ReportProxy.NAME) as ReportProxy;
		}
		override public function execute(notification:INotification):void{
			switch(notification.getName()){
				case ReportWindow.DO_REFRESH_GROUP:
					proxy.loadGroupList();
					break;
				case ReportWindow.DO_REFRESH_REPORT1:
					proxy.loadReport1List(notification.getBody());
					break;
				case ReportWindow.DO_REFRESH_REPORT2:
					proxy.loadReport2List(notification.getBody());
					break;
			}
		}
	}
}